]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
Move Workspaces-size computation into Workspaces
authorDan Winship <danw@src.gnome.org>
Mon, 22 Dec 2008 21:50:23 +0000 (21:50 +0000)
committerDan Winship <danw@src.gnome.org>
Mon, 22 Dec 2008 21:50:23 +0000 (21:50 +0000)
svn path=/trunk/; revision=134

js/ui/overlay.js
js/ui/workspaces.js

index d7bea99fcbba23835553ff60b8a51f6f29a9f72e..a1699e8753e8893e78cb81f957ee6b651e2ee619 100644 (file)
@@ -34,6 +34,9 @@ const ANIMATION_TIME = 0.5;
 // How much of the screen the workspace grid takes up
 const WORKSPACE_GRID_SCALE = 0.75;
 
+// Padding around workspace grid / Spacing between Sideshow and Workspaces
+const WORKSPACE_GRID_PADDING = 10;
+
 function Sideshow(parent, width) {
     this._init(parent, width);
 }
@@ -226,9 +229,10 @@ Overlay.prototype = {
         global.overlay_group.add_actor(this._group);
 
         // TODO - recalculate everything when desktop size changes
-        this._recalculateSize();
-
-        this._sideshow = new Sideshow(this._group, this._workspaceGridX - 10);
+        let screenWidth = global.screen_width;
+        let sideshowWidth = screenWidth - (screenWidth * WORKSPACE_GRID_SCALE) -
+            2 * WORKSPACE_GRID_PADDING;
+        this._sideshow = new Sideshow(this._group, sideshowWidth);
         this._sideshow.connect('activated', function(sideshow) {
             // TODO - have some sort of animation/effect while
             // transitioning to the new app.  We definitely need
@@ -237,18 +241,6 @@ Overlay.prototype = {
         });
     },
 
-    _recalculateSize: function() {
-        let global = Shell.Global.get();
-        let screenWidth = global.screen_width;
-        let screenHeight = global.screen_height;
-
-        // The area allocated for the workspace grid
-        this._workspaceGridWidth = screenWidth * WORKSPACE_GRID_SCALE;
-        this._workspaceGridHeight = screenHeight * WORKSPACE_GRID_SCALE;
-        this._workspaceGridX = screenWidth - this._workspaceGridWidth - 10;
-        this._workspaceGridY = Panel.PANEL_HEIGHT + (screenHeight - this._workspaceGridHeight - Panel.PANEL_HEIGHT) / 2;
-    },
-
     show : function() {
         if (this.visible)
             return;
@@ -257,13 +249,9 @@ Overlay.prototype = {
 
         let global = Shell.Global.get();
 
-        this._recalculateSize();
-
         this._sideshow.show();
 
-        this._workspaces = new Workspaces.Workspaces(
-            this._workspaceGridX, this._workspaceGridY,
-            this._workspaceGridWidth, this._workspaceGridHeight);
+        this._workspaces = new Workspaces.Workspaces();
         this._group.add_actor(this._workspaces.actor);
         this._workspaces.actor.raise_top();
 
index 2194ae0770eacc3b4a2259673cd97fd03c94ed75..d39e58a96500bf9a3a62a1e62983736c5840e0ce 100644 (file)
@@ -38,25 +38,29 @@ const POSITIONS = {
 // metaphor-breaking, but the alternatives are also weird.
 const GRID_SPACING = 15;
 
-function Workspaces(x, y, width, height) {
-    this._init(x, y, width, height);
+function Workspaces() {
+    this._init();
 }
 
 Workspaces.prototype = {
-    _init : function(x, y, width, height) {
+    _init : function() {
         let me = this;
+        let global = Shell.Global.get();
 
         this.actor = new Clutter.Group();
 
-        this._x = x;
-        this._y = y;
-        this._width = width;
-        this._height = height;
+        let screenWidth = global.screen_width;
+        let screenHeight = global.screen_height;
+
+        this._width = screenWidth * Overlay.WORKSPACE_GRID_SCALE;
+        this._height = screenHeight * Overlay.WORKSPACE_GRID_SCALE;
+        this._x = screenWidth - this._width - Overlay.WORKSPACE_GRID_PADDING;
+        this._y = Panel.PANEL_HEIGHT + (screenHeight - this._height - Panel.PANEL_HEIGHT) / 2;
+
         this._workspaces = [];
         
         this._clones = [];
 
-        let global = Shell.Global.get();
         let windows = global.get_windows();
         let activeWorkspaceIndex = global.screen.get_active_workspace_index();
         let activeWorkspace;